GtkCheckMenuItemAccessible: Make work with model menu items
authorMatthias Clasen <mclasen@redhat.com>
Sun, 5 Jan 2014 02:48:19 +0000 (21:48 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 5 Jan 2014 02:53:31 +0000 (21:53 -0500)
GtkModelMenuItem does not emit the ::toggled signal when a radio
item is activated, so listen for property notification for that
property. We still keep the ::toggled signal handler, in order
to not break other uses of check and radio menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=720983

gtk/a11y/gtkcheckmenuitemaccessible.c

index 694fec45062da85d8dcba3e1a8d682acf6095226..e0011f5a3ae93d9f9f809cbcf66dec3c557fe4a1 100644 (file)
@@ -84,10 +84,12 @@ gtk_check_menu_item_accessible_notify_gtk (GObject    *obj,
   AtkObject *atk_obj;
   gboolean sensitive;
   gboolean inconsistent;
+  gboolean active;
 
   atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item));
   sensitive = gtk_widget_get_sensitive (GTK_WIDGET (check_menu_item));
   inconsistent = gtk_check_menu_item_get_inconsistent (check_menu_item);
+  active = gtk_check_menu_item_get_active (check_menu_item);
 
   if (strcmp (pspec->name, "inconsistent") == 0)
     {
@@ -100,6 +102,10 @@ gtk_check_menu_item_accessible_notify_gtk (GObject    *obj,
       atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
       atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
     }
+  else if (strcmp (pspec->name, "active") == 0)
+    {
+      atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, active);
+    }
   else
     GTK_WIDGET_ACCESSIBLE_CLASS (gtk_check_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
 }